<template>
	<div id="app">
		<router-view></router-view>
	</div>
</template>

<script>
export default {
	name: 'app',
	data() {
		return {
		};
	},
	created() {
		// 初始化系统
		this.$store.dispatch('system/getSystemInfo').then(data => {
			let links = document.getElementsByTagName("link")
			for (let link of links) {
				if (link.type && link.type == 'image/x-icon') {
					link.href = data.ico
				}
			}
			let metas = document.getElementsByTagName("meta")
			for (let meta of metas) {
				if (!meta.name) {
					continue
				}
				if (meta.name == 'keywords') {
					meta.content = data.seo
				} else if (meta.name == 'description') {
					meta.content = data.description
				}
			}
		})
	},
	mounted: function() {
		let that = this;
		window.onload = function() {
			that.autoRootFontSize();
		};
		window.onresize = function() {
			that.autoRootFontSize();
		};
	},
	methods: {
		autoRootFontSize() {
			let width = Math.min(document.body.clientWidth, document.documentElement.clientWidth);
			let html = document.getElementsByTagName('html')[0];
			// 这里的750是指设计图的大小,自己根据实际情况改变,按照字体37.5px计算
			html.style.fontSize = (width / 10) + 'px';
		}
	}
};
</script>

<style>
</style>
